home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume6 / xdvi / patch8 < prev    next >
Encoding:
Internet Message Format  |  1990-03-26  |  53.5 KB

  1. Path: uunet!cs.utexas.edu!usc!brutus.cs.uiuc.edu!lll-winken!sun-barr!newstop!sun!guinness.ias.edu
  2. From: vojta@guinness.ias.edu (Paul A Vojta)
  3. Newsgroups: comp.sources.x
  4. Subject: REPOST: v06i049: xdvi, Patch8
  5. Message-ID: <133464@sun.Eng.Sun.COM>
  6. Date: 26 Mar 90 19:52:47 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 1811
  9. Approved: argv@sun.com
  10.  
  11. [ Moderator's Note:
  12.   The previous patch sent out was incorrect.  A later submission
  13.   obsoleted the previous patch altho there are few changes.
  14.   Please use *THIS* file, not the previous one, as Patch #8.
  15.   For some reason, I have been unable to cancel the previous
  16.   article.  If someone has a "sneaky" way to do that, please advise. 
  17. ]
  18.  
  19. Submitted-by: vojta@guinness.ias.edu (Paul A Vojta)
  20. Posting-number: Volume 6, Issue 49
  21. Archive-name: xdvi/patch8
  22. Patch-To: xdvi: Volume 3, Issues 37-39
  23. Patch-To: Volume 4, Issue 44 (xdvi, Patch4)
  24. Patch-To: Volume 4, Issue 96 (xdvi, dvi previewer, Patch5)
  25. Patch-To: Volume 5, Issue 35 (xdvi, dvi previewer, patch 6, part 1/2)
  26. Patch-To: Volume 5, Issue 36 (xdvi, dvi previewer, patch 6, part 2/2)
  27. Patch-To: Volume 6, Issue  5 (xdvi, Patch7)
  28.  
  29. Here is patch level 8 for xdvi.  It can now be compiled under VMS (many
  30. thanks to Scott.Allendorf@CERES.Physics.UIowa.Edu for assistance)
  31. and it is now compatible with X11R4.
  32.  
  33. Plus the usual round of bug fixes; for these I owe thanks to:
  34.     casey@gauss.llnl.gov (Casey Leedom)
  35.     David Burgess <dhb%maths.qmw.ac.uk@NSFNET-RELAY.AC.UK>
  36. and    Peter Lamb (iis!prl)
  37.  
  38. IMPORTANT NOTE:  at this stage you should do the following:
  39. IMPORTANT NOTE:      mv xdvi.man.sed xdvi_man.sed
  40. IMPORTANT NOTE:  This is necessary for VMS compatibility.
  41. -- cut here --
  42. diff -cr old/Imakefile new/Imakefile
  43. *** old/Imakefile    Sun Mar 25 21:21:31 1990
  44. --- new/Imakefile    Fri Mar 16 20:59:09 1990
  45. ***************
  46. *** 7,13 ****
  47.   FONTFORMATS_C=gf.c pk.c pxl.c
  48.   FONTFORMATS_O=gf.o pk.o pxl.o
  49.   
  50. ! LOCAL_LIBRARIES=$(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) -lm
  51.   SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
  52.   OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
  53.   
  54. --- 7,16 ----
  55.   FONTFORMATS_C=gf.c pk.c pxl.c
  56.   FONTFORMATS_O=gf.o pk.o pxl.o
  57.   
  58. ! DEPLIBS=XawClientDepLibs
  59. ! LOCAL_LIBRARIES=XawClientLibs
  60. ! MATHLIB=-lm
  61. ! SYS_LIBRARIES=$(MATHLIB)
  62.   SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
  63.   OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
  64.   
  65. ***************
  66. *** 16,26 ****
  67.   pxl_open.o:
  68.       $(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
  69.   
  70. ! xdvi.man: xdvi.man.sed
  71.       chmod u+x mksedscript
  72.       mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFINES) \
  73.           > sedscript
  74. !     sed -f sedscript < xdvi.man.sed > xdvi.man
  75.   
  76.   clean::
  77.       $(RM) sedscript xdvi.man xdvi10.man.s
  78. --- 19,29 ----
  79.   pxl_open.o:
  80.       $(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
  81.   
  82. ! xdvi.man: xdvi_man.sed
  83.       chmod u+x mksedscript
  84.       mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFINES) \
  85.           > sedscript
  86. !     sed -f sedscript < xdvi_man.sed > xdvi.man
  87.   
  88.   clean::
  89.       $(RM) sedscript xdvi.man xdvi10.man.s
  90. diff -cr old/MAKE_VMS.COM new/MAKE_VMS.COM
  91. *** old/MAKE_VMS.COM    Sun Mar 25 21:22:19 1990
  92. --- new/MAKE_VMS.COM    Sun Mar 11 21:54:42 1990
  93. ***************
  94. *** 0 ****
  95. --- 1,14 ----
  96. + $ DEFINE X11 DECW$INCLUDE 
  97. + $ DEFINE SYS SYS$LIBRARY
  98. + $ CC /DEFINE = (BMLONG, NOTOOL) DVI_INIT
  99. + $ CC /DEFINE = (BMLONG, NOTOOL) DVI_DRAW
  100. + $ CC /DEFINE = (BMLONG, NOTOOL) GF
  101. + $ CC /DEFINE = (BMLONG, NOTOOL) PK
  102. + $ CC /DEFINE = (BMLONG, NOTOOL) PXL
  103. + $ CC /DEFINE = (BMLONG, NOTOOL, -
  104. +      "DEFAULT_FONT_PATH=""TEX$FONTS""", -
  105. +      "DEFAULT_FONT_SIZES=""300/328.6/360/432/518.4/622/746.4""") PXL_OPEN
  106. + $ CC /DEFINE = (BMLONG, NOTOOL) TPIC
  107. + $ CC /DEFINE = (BMLONG, NOTOOL) XDVI
  108. + $ LINK XDVI, DVI_INIT, DVI_DRAW, GF, PK, PXL, PXL_OPEN, TPIC, VMS_C.OPT /OPTION
  109. + $ EXIT
  110. diff -cr old/Makefile new/Makefile
  111. *** old/Makefile    Sun Mar 25 21:21:32 1990
  112. --- new/Makefile    Sun Mar 25 21:23:52 1990
  113. ***************
  114. *** 7,29 ****
  115.   DEFAULT_FONT_PATH=/usr/local/tex/fonts
  116.   DEFAULT_FONT_SIZES=300:328.6:360:432:518.4:622:746.4
  117.   DEFINES=-DMSBITFIRST \
  118. !   -DBMSHORT
  119.   FONTDEFINES=-DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
  120.     -DDEFAULT_FONT_SIZES=\"$(DEFAULT_FONT_SIZES)\"
  121.   FONTFORMATS_C=gf.c pk.c pxl.c
  122.   FONTFORMATS_O=gf.o pk.o pxl.o
  123.   LIBDIR=/usr/custom/x11/lib
  124. ! #LIBDIR=/tuna_a/x11r3/lib
  125.   INCDIR=/usr/include
  126. ! #INCDIR=/tuna_a/x11r3/include
  127.   XMULIB=
  128.   #XMULIB=-lXmu
  129.   DESTDIR=/usr/local/x11
  130.   BINDIR=$(DESTDIR)/bin
  131.   MANDIR=$(DESTDIR)/man
  132.   INCLUDES=-I$(INCDIR)
  133.   CFLAGS=-O $(INCLUDES) $(DEFINES)
  134. ! LIBS=-L$(LIBDIR) -lXaw $(XMULIB) -lXt -lX11 -lm
  135.   SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
  136.   OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
  137.   CC=/tuna_a/gnu/bin/gcc
  138. --- 7,30 ----
  139.   DEFAULT_FONT_PATH=/usr/local/tex/fonts
  140.   DEFAULT_FONT_SIZES=300:328.6:360:432:518.4:622:746.4
  141.   DEFINES=-DMSBITFIRST \
  142. !   -DBMSHORT -DBUTTONS
  143.   FONTDEFINES=-DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
  144.     -DDEFAULT_FONT_SIZES=\"$(DEFAULT_FONT_SIZES)\"
  145.   FONTFORMATS_C=gf.c pk.c pxl.c
  146.   FONTFORMATS_O=gf.o pk.o pxl.o
  147.   LIBDIR=/usr/custom/x11/lib
  148. ! #LIBDIR=/tuna_a/x11r4/lib
  149.   INCDIR=/usr/include
  150. ! #INCDIR=/tuna_a/x11r4/include
  151.   XMULIB=
  152.   #XMULIB=-lXmu
  153. + EXTENSIONLIB=-lXext
  154.   DESTDIR=/usr/local/x11
  155.   BINDIR=$(DESTDIR)/bin
  156.   MANDIR=$(DESTDIR)/man
  157.   INCLUDES=-I$(INCDIR)
  158.   CFLAGS=-O $(INCLUDES) $(DEFINES)
  159. ! LIBS=-L$(LIBDIR) -lXaw $(XMULIB) -lXt $(EXTENSIONLIB) -lX11 -lm
  160.   SRCS=xdvi.c dvi_init.c dvi_draw.c $(FONTFORMATS_C) pxl_open.c tpic.c
  161.   OBJS=xdvi.o dvi_init.o dvi_draw.o $(FONTFORMATS_O) pxl_open.o tpic.o
  162.   CC=/tuna_a/gnu/bin/gcc
  163. ***************
  164. *** 48,58 ****
  165.   pxl_open.o:
  166.       $(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
  167.   
  168. ! xdvi.man: xdvi.man.sed
  169.       chmod u+x mksedscript
  170.       mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFINES) \
  171.           > sedscript
  172. !     sed -f sedscript < xdvi.man.sed > xdvi.man
  173.   
  174.   install: xdvi xdvi.man
  175.       install -c -s -m 755 xdvi $(BINDIR)
  176. --- 49,59 ----
  177.   pxl_open.o:
  178.       $(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
  179.   
  180. ! xdvi.man: xdvi_man.sed
  181.       chmod u+x mksedscript
  182.       mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFINES) \
  183.           > sedscript
  184. !     sed -f sedscript < xdvi_man.sed > xdvi.man
  185.   
  186.   install: xdvi xdvi.man
  187.       install -c -s -m 755 xdvi $(BINDIR)
  188. diff -cr old/Makefile_10 new/Makefile_10
  189. *** old/Makefile_10    Sun Mar 25 21:21:33 1990
  190. --- new/Makefile_10    Sun Mar 25 21:20:08 1990
  191. ***************
  192. *** 41,51 ****
  193.   pxl_open.o:
  194.       $(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
  195.   
  196. ! xdvi.man: xdvi.man.sed
  197.       chmod u+x mksedscript
  198.       mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFINES) \
  199.           > sedscript
  200. !     sed -f sedscript < xdvi.man.sed > xdvi.man
  201.   
  202.   install: xdvi xdvi.man
  203.       install -c -s -m 755 xdvi $(BINDIR)
  204. --- 41,51 ----
  205.   pxl_open.o:
  206.       $(CC) -c $(CFLAGS) $(FONTDEFINES) pxl_open.c
  207.   
  208. ! xdvi.man: xdvi_man.sed
  209.       chmod u+x mksedscript
  210.       mksedscript $(DEFAULT_FONT_PATH) $(DEFAULT_FONT_SIZES) $(DEFINES) \
  211.           > sedscript
  212. !     sed -f sedscript < xdvi_man.sed > xdvi.man
  213.   
  214.   install: xdvi xdvi.man
  215.       install -c -s -m 755 xdvi $(BINDIR)
  216. diff -cr old/README new/README
  217. *** old/README    Sun Mar 25 21:21:34 1990
  218. --- new/README    Tue Mar 13 22:36:46 1990
  219. ***************
  220. *** 37,42 ****
  221. --- 37,43 ----
  222.               you use for storing fonts.
  223.       SYSV        (dvi_init pxl_open xdvi.c)  Set for System V
  224.               compilation.
  225. +     VMS        Set for VMS compilation.
  226.       MSBITFIRST    (X11 only; xdvi.c dvi_draw.c gf.c pk.c pxl.c)  Store
  227.               bitmaps internally with the most significant bit at
  228.               the left.  For performance reasons, it would be best
  229. ***************
  230. *** 174,178 ****
  231. --- 175,181 ----
  232.      20.  Added a yet more robust font finding algorithm.
  233.   --  Patchlevel 7:  --
  234.      21.  Replaced -pagewidth and -pageheight options with -paper.
  235. + --  Patchlevel 8:  --
  236. +    22.  Added compatibility for X11R4 and VMS.  Fixed up alignment of rules.
  237.   
  238.   Paul Vojta, vojta@math.berkeley.edu
  239. diff -cr old/VMS_C.OPT new/VMS_C.OPT
  240. *** old/VMS_C.OPT    Sun Mar 25 21:22:38 1990
  241. --- new/VMS_C.OPT    Sun Mar 11 21:54:51 1990
  242. ***************
  243. *** 0 ****
  244. --- 1,2 ----
  245. + sys$share:decw$xlibshr/share
  246. + sys$share:vaxcrtl/share
  247. diff -cr old/dvi_draw.c new/dvi_draw.c
  248. *** old/dvi_draw.c    Sun Mar 25 21:21:37 1990
  249. --- new/dvi_draw.c    Fri Mar 16 21:31:43 1990
  250. ***************
  251. *** 12,20 ****
  252. --- 12,22 ----
  253.    *            --Paul Vojta, UC Berkeley.
  254.    * 2/1989    Added tpic support    --Jeffrey Lee, U of Toronto
  255.    * 4/1989    Modified for System V by Donald Richardson, Clarkson Univ.
  256. +  * 3/1990    Added VMS support    --Scott Allendorf, U of Iowa
  257.    *
  258.    *    Compilation options:
  259.    *    SYSV    compile for System V
  260. +  *    VMS    compile for VMS
  261.    *    X10    compile for X10
  262.    *    NOTOOL    compile without toolkit (X11 only)
  263.    *    BUTTONS    compile with buttons on the side of the window (needs toolkit)
  264. ***************
  265. *** 30,40 ****
  266.   #include "xdvi.h"
  267.   #include "dvi.h"
  268.   
  269. ! #define X_PAGE_OFFSET    ROUNDUP(pixels_per_inch, shrink_factor)
  270. ! #define Y_PAGE_OFFSET    ROUNDUP(pixels_per_inch, shrink_factor)
  271.   
  272.   struct frame    *stack;
  273. ! int    stackp;
  274.   
  275.   #ifndef    BMLONG
  276.   #ifndef    BMSHORT
  277. --- 32,47 ----
  278.   #include "xdvi.h"
  279.   #include "dvi.h"
  280.   
  281. ! /*
  282. !  *    Explanation of the following constant:
  283. !  *    pixels_per_inch << 16:    one inch margin
  284. !  *    shrink_factor << 16:    one pixel page border
  285. !  *    shrink_factor << 15:    rounding for pixel_conv
  286. !  */
  287. ! #define PAGE_OFFSET    (pixels_per_inch << 16) + (shrink_factor * 3 << 15)
  288.   
  289.   struct frame    *stack;
  290. ! struct frame    *stackp;
  291.   
  292.   #ifndef    BMLONG
  293.   #ifndef    BMSHORT
  294. ***************
  295. *** 327,333 ****
  296.       int h, w;
  297.   {
  298.       /* (w,h) specifies lower left corner of rule box */
  299. !     put_rectangle(PXL_H, PXL_V - h, w, h, False);
  300.   }
  301.   
  302.   /**
  303. --- 334,340 ----
  304.       int h, w;
  305.   {
  306.       /* (w,h) specifies lower left corner of rule box */
  307. !     put_rectangle(PXL_H, PXL_V - h + 1, w, h, False);
  308.   }
  309.   
  310.   /**
  311. ***************
  312. *** 414,420 ****
  313.       /* Check for changes in dvi file. */
  314.       if (!check_dvi_file()) return;
  315.   
  316. !     put_border(0, 0, PAPER_WIDTH, PAPER_HEIGHT, 1);
  317.   
  318.       Fseek(dvi_file, page_offset[current_page], 0);
  319.       for (;;) {
  320. --- 421,428 ----
  321.       /* Check for changes in dvi file. */
  322.       if (!check_dvi_file()) return;
  323.   
  324. !     put_border(ROUNDUP(unshrunk_paper_w, shrink_factor) + 1,
  325. !         ROUNDUP(unshrunk_paper_h, shrink_factor) + 1, 1);
  326.   
  327.       Fseek(dvi_file, page_offset[current_page], 0);
  328.       for (;;) {
  329. ***************
  330. *** 459,487 ****
  331.   
  332.                   case BOP:
  333.                   Fseek(dvi_file, (long) 11*4, 1);
  334. !                 stackp = 0;
  335. !                 DVI_H = pxl2spell(X_PAGE_OFFSET);
  336. !                 DVI_V = pxl2spell(Y_PAGE_OFFSET);
  337. !                 PXL_V = Y_PAGE_OFFSET;
  338.                   WW = XX = YY = ZZ = 0;
  339.                   break;
  340.   
  341.                   case EOP:
  342. !                 if (stackp > 0)
  343. !                     oops("Stack not empty at EOP (%d)", stackp);
  344.                   return;
  345.   
  346.                   case PUSH:
  347.                   stackp++;
  348. !                 if (stackp > maxstack)
  349.                       oops("More PUSHes than were promised");
  350. !                 stack[stackp] = stack[stackp - 1];
  351.                   break;
  352.   
  353.                   case POP:
  354. !                 stackp--;
  355. !                 if (stackp < 0)
  356.                       oops("More POPs than PUSHes");
  357.                   break;
  358.   
  359.                   case RIGHT1:
  360. --- 467,495 ----
  361.   
  362.                   case BOP:
  363.                   Fseek(dvi_file, (long) 11*4, 1);
  364. !                 stackp = stack;
  365. !                 DVI_H = DVI_V = PAGE_OFFSET;
  366. !                 PXL_V = pixel_conv(PAGE_OFFSET);
  367.                   WW = XX = YY = ZZ = 0;
  368.                   break;
  369.   
  370.                   case EOP:
  371. !                 if (stackp > stack)
  372. !                     oops("Stack not empty at EOP (%d)",
  373. !                     stackp - stack);
  374.                   return;
  375.   
  376.                   case PUSH:
  377.                   stackp++;
  378. !                 if (stackp > stack + maxstack)
  379.                       oops("More PUSHes than were promised");
  380. !                 *stackp = stackp[-1];
  381.                   break;
  382.   
  383.                   case POP:
  384. !                 if (stackp <= stack)
  385.                       oops("More POPs than PUSHes");
  386. +                 stackp--;
  387.                   break;
  388.   
  389.                   case RIGHT1:
  390. diff -cr old/dvi_init.c new/dvi_init.c
  391. *** old/dvi_init.c    Sun Mar 25 21:21:39 1990
  392. --- new/dvi_init.c    Fri Mar 16 20:46:59 1990
  393. ***************
  394. *** 12,20 ****
  395. --- 12,22 ----
  396.    *            --Paul Vojta, UC Berkeley.
  397.    * 2/1989    Added tpic support    --Jeffrey Lee, U of Toronto
  398.    * 4/1989    Modified for System V by Donald Richardson, Clarkson Univ.
  399. +  * 3/1990    Added VMS support    --Scott Allendorf, U of Iowa
  400.    *
  401.    *    Compilation options:
  402.    *    SYSV    compile for System V
  403. +  *    VMS    compile for VMS
  404.    *    X10    compile for X10
  405.    *    NOTOOL    compile without toolkit (X11 only)
  406.    *    BUTTONS    compile with buttons on the side of the window (needs toolkit)
  407. ***************
  408. *** 238,245 ****
  409.                 ||  denominator != four(dvi_file)
  410.             ||  magnification != four(dvi_file))
  411.           dvi_oops("Postamble doesn't match preamble");
  412. !     (void) four(dvi_file);    /* page height */
  413. !     (void) four(dvi_file);    /* page width */
  414.       maxstack = two(dvi_file);
  415.       total_pages = two(dvi_file);
  416.       old_fonts = ¤t_font;
  417. --- 240,252 ----
  418.                 ||  denominator != four(dvi_file)
  419.             ||  magnification != four(dvi_file))
  420.           dvi_oops("Postamble doesn't match preamble");
  421. !         /* read largest box height and width */
  422. !     unshrunk_page_h = (spellfour(dvi_file) >> 16) + pixels_per_inch;
  423. !     if (unshrunk_page_h < unshrunk_paper_h)
  424. !         unshrunk_page_h = unshrunk_paper_h;
  425. !     unshrunk_page_w = (spellfour(dvi_file) >> 16) + pixels_per_inch;
  426. !     if (unshrunk_page_w < unshrunk_paper_w)
  427. !         unshrunk_page_w = unshrunk_paper_w;
  428.       maxstack = two(dvi_file);
  429.       total_pages = two(dvi_file);
  430.       old_fonts = ¤t_font;
  431. ***************
  432. *** 315,322 ****
  433.   
  434.   init_page()
  435.   {
  436. !     page_h = PAPER_HEIGHT;
  437. !     page_w = PAPER_WIDTH;
  438.   }
  439.   
  440.   /*
  441. --- 322,329 ----
  442.   
  443.   init_page()
  444.   {
  445. !     page_w = ROUNDUP(unshrunk_page_w, mane.shrinkfactor) + 2;
  446. !     page_h = ROUNDUP(unshrunk_page_h, mane.shrinkfactor) + 2;
  447.   }
  448.   
  449.   /*
  450. diff -cr old/mksedscript new/mksedscript
  451. *** old/mksedscript    Sun Mar 25 21:21:42 1990
  452. --- new/mksedscript    Tue Mar 13 21:52:41 1990
  453. ***************
  454. *** 22,25 ****
  455.   endif
  456.   echo    s\;%%DEFAULT_FONT_PATH%%\;$1\;
  457.   echo    s/%%DEFAULT_FONT_SIZES%%/$2/
  458. - rm -f xdvi10.man.s
  459. --- 22,24 ----
  460. diff -cr old/patchlevel.h new/patchlevel.h
  461. *** old/patchlevel.h    Sun Mar 25 21:21:42 1990
  462. --- new/patchlevel.h    Sun Feb 18 18:39:02 1990
  463. ***************
  464. *** 1 ****
  465. ! #define PATCHLEVEL 7
  466. --- 1 ----
  467. ! #define PATCHLEVEL 8
  468. diff -cr old/pxl_open.c new/pxl_open.c
  469. *** old/pxl_open.c    Sun Mar 25 21:21:47 1990
  470. --- new/pxl_open.c    Tue Mar 13 21:35:13 1990
  471. ***************
  472. *** 49,59 ****
  473. --- 49,71 ----
  474.   #include <errno.h>
  475.   extern    int    errno;
  476.   
  477. + #ifndef    VMS
  478.   #define    PATH_SEP    ':'
  479.   #define    DEFAULT_TAIL    "/%f.%d%p"
  480. + #else    VMS
  481. + #include <string.h>
  482. + #define    index    strchr
  483. + #define    rindex    strrchr
  484. + #define    PATH_SEP    '/'
  485. + #define    DEFAULT_TAIL    ":%f.%d%p"
  486. + #endif    VMS
  487.   
  488.   #ifndef    OPEN_MODE
  489. + #ifndef    VMS
  490.   #define    OPEN_MODE    "r"
  491. + #else    VMS
  492. + #define    OPEN_MODE    "r", "ctx=stm"
  493. + #endif    VMS
  494.   #endif    OPEN_MODE
  495.   
  496.   extern    int    n_fonts_left;
  497. diff -cr old/xdvi.c new/xdvi.c
  498. *** old/xdvi.c    Sun Mar 25 21:21:55 1990
  499. --- new/xdvi.c    Fri Mar 16 20:47:25 1990
  500. ***************
  501. *** 12,20 ****
  502. --- 12,22 ----
  503.    *            --Paul Vojta, UC Berkeley.
  504.    * 2/1989    Added tpic support    --Jeffrey Lee, U of Toronto
  505.    * 4/1989    Modified for System V by Donald Richardson, Clarkson Univ.
  506. +  * 3/1990    Added VMS support    --Scott Allendorf, U of Iowa
  507.    *
  508.    *    Compilation options:
  509.    *    SYSV    compile for System V
  510. +  *    VMS    compile for VMS
  511.    *    X10    compile for X10
  512.    *    NOTOOL    compile without toolkit (X11 only)
  513.    *    BUTTONS    compile with buttons on the side of the window (needs toolkit)
  514. ***************
  515. *** 70,84 ****
  516.   #include <X11/StringDefs.h>
  517.   #endif not OLD_X11_TOOLKIT
  518.   #include <X11/Shell.h>    /* needed for def. of XtNiconX */
  519.   #include <X11/Viewport.h>
  520.   #ifdef    BUTTONS
  521. - #include <X11/Form.h>
  522.   #include <X11/Command.h>
  523.   #endif    BUTTONS
  524.   #else    TOOLKIT
  525.   #define    XtNumber(arr)    (sizeof(arr)/sizeof(arr[0]))
  526.   typedef    int        Position;
  527. ! typedef    int        Dimension;
  528.   #ifndef X10
  529.   typedef    unsigned int    Pixel;
  530.   #define    XtPending()    XPending(DISP)
  531. --- 72,95 ----
  532.   #include <X11/StringDefs.h>
  533.   #endif not OLD_X11_TOOLKIT
  534.   #include <X11/Shell.h>    /* needed for def. of XtNiconX */
  535. + #ifndef    XtSpecificationRelease
  536. + #define    XtSpecificationRelease    0
  537. + #endif
  538. + #if    XtSpecificationRelease >= 4
  539. + #include <X11/Xaw/Viewport.h>
  540. + #ifdef    BUTTONS
  541. + #include <X11/Xaw/Command.h>
  542. + #endif    BUTTONS
  543. + #else    XtSpecificationRelease
  544.   #include <X11/Viewport.h>
  545.   #ifdef    BUTTONS
  546.   #include <X11/Command.h>
  547.   #endif    BUTTONS
  548. + #endif    XtSpecificationRelease
  549.   #else    TOOLKIT
  550.   #define    XtNumber(arr)    (sizeof(arr)/sizeof(arr[0]))
  551.   typedef    int        Position;
  552. ! typedef    unsigned int    Dimension;
  553.   #ifndef X10
  554.   typedef    unsigned int    Pixel;
  555.   #define    XtPending()    XPending(DISP)
  556. ***************
  557. *** 90,98 ****
  558.   
  559.   #include <stdio.h>
  560.   #include <ctype.h>
  561.   #include <fcntl.h>
  562.   #include <signal.h>
  563. ! #include "xdvi.h"
  564.   
  565.   #ifndef X10
  566.   static    Display    *DISP;
  567. --- 101,112 ----
  568.   
  569.   #include <stdio.h>
  570.   #include <ctype.h>
  571. + #include "xdvi.h"
  572. + #ifdef    HAS_SIGIO
  573.   #include <fcntl.h>
  574.   #include <signal.h>
  575. ! #endif    HAS_SIGIO
  576.   
  577.   #ifndef X10
  578.   static    Display    *DISP;
  579. ***************
  580. *** 99,106 ****
  581.   #define    DPY    DISP,
  582.   static    Screen    *SCRN;
  583.   static    Cursor    redraw_cursor, ready_cursor;
  584. ! #define    SetCursor(x)    XDefineCursor(DISP, mane.win, x)
  585. ! #define    ClearPage(wr)    XClearWindow(DISP, (wr).win);
  586.   #define    ClearArea(win, x, y, w, h)    XClearArea(DISP, win, x, y, w, h, False)
  587.   #define    DarkenArea(win, x, y, w, h) \
  588.               XFillRectangle(DISP, win, ruleGC, x, y, w, h)
  589. --- 113,120 ----
  590.   #define    DPY    DISP,
  591.   static    Screen    *SCRN;
  592.   static    Cursor    redraw_cursor, ready_cursor;
  593. ! #define    SetCursor(x)    XDefineCursor(DISP, WINDOW(mane), x)
  594. ! #define    ClearPage(wr)    XClearWindow(DISP, WINDOW(wr));
  595.   #define    ClearArea(win, x, y, w, h)    XClearArea(DISP, win, x, y, w, h, False)
  596.   #define    DarkenArea(win, x, y, w, h) \
  597.               XFillRectangle(DISP, win, ruleGC, x, y, w, h)
  598. ***************
  599. *** 115,121 ****
  600.   #define    DPY
  601.   #define    GC        int
  602.   #define    SetCursor(x)
  603. ! #define    ClearPage(wr)    XClear((wr).win);
  604.   #define    ClearArea(win, x, y, w, h)    XPixSet(win, x, y, w, h, backpix)
  605.   #define    DarkenArea(win, x, y, w, h)    XPixSet(win, x, y, w, h, foreGC)
  606.   #define    CopyArea(win, x, y, w, h, x2, y2) \
  607. --- 129,135 ----
  608.   #define    DPY
  609.   #define    GC        int
  610.   #define    SetCursor(x)
  611. ! #define    ClearPage(wr)    XClear(WINDOW(wr));
  612.   #define    ClearArea(win, x, y, w, h)    XPixSet(win, x, y, w, h, backpix)
  613.   #define    DarkenArea(win, x, y, w, h)    XPixSet(win, x, y, w, h, foreGC)
  614.   #define    CopyArea(win, x, y, w, h, x2, y2) \
  615. ***************
  616. *** 140,145 ****
  617. --- 154,160 ----
  618.   
  619.   int    density = 40;
  620.   int    pixels_per_inch = 300;
  621. + int    unshrunk_paper_w, unshrunk_paper_h;
  622.   int    unshrunk_page_w, unshrunk_page_h;
  623.   static    char    *paper        = DEFAULT_PAPER;
  624.   static    char    *margins, *sidemargin, *topmargin;
  625. ***************
  626. *** 240,254 ****
  627.       {XtNlabel,    (XtArgVal) ""},
  628.   };
  629.   
  630. - static    void    set_draw_args();
  631.   #ifdef    BUTTONS
  632. - static    Widget    form_widget;
  633.   static    Arg    form_args[] = {
  634.       {XtNdefaultDistance, (XtArgVal) 0},
  635.   };
  636.   
  637.   static    struct {
  638.       char    *label;
  639.       char    *name;
  640. --- 255,289 ----
  641.       {XtNlabel,    (XtArgVal) ""},
  642.   };
  643.   
  644.   #ifdef    BUTTONS
  645.   static    Arg    form_args[] = {
  646.       {XtNdefaultDistance, (XtArgVal) 0},
  647.   };
  648. + #define    XTRA_WID    79
  649.   
  650. + static    Arg    line_args[] = {
  651. +     {XtNbackground,    (XtArgVal) 0},
  652. +     {XtNwidth,    (XtArgVal) 1},
  653. +     {XtNheight,    (XtArgVal) 0},
  654. +     {XtNfromHoriz,    (XtArgVal) NULL},
  655. +     {XtNborderWidth, (XtArgVal) 0},
  656. +     {XtNtop,    (XtArgVal) XtChainTop},
  657. +     {XtNbottom,    (XtArgVal) XtChainBottom},
  658. +     {XtNleft,    (XtArgVal) XtChainRight},
  659. +     {XtNright,    (XtArgVal) XtChainRight},
  660. + };
  661. + static    Arg    right_args[] = {
  662. +     {XtNfromHoriz,    (XtArgVal) NULL},
  663. +     {XtNwidth,    (XtArgVal) (XTRA_WID - 1)},
  664. +     {XtNheight,    (XtArgVal) 0},
  665. +     {XtNborderWidth, (XtArgVal) 0},
  666. +     {XtNtop,    (XtArgVal) XtChainTop},
  667. +     {XtNbottom,    (XtArgVal) XtChainBottom},
  668. +     {XtNleft,    (XtArgVal) XtChainRight},
  669. +     {XtNright,    (XtArgVal) XtChainRight},
  670. + };
  671.   static    struct {
  672.       char    *label;
  673.       char    *name;
  674. ***************
  675. *** 269,276 ****
  676.           {"Page-10",    "prev10",    10 << 8 | 'p',    700},
  677.   };
  678.   
  679. - static    Widget    command_wid[XtNumber(command_table)];
  680.   static    void    handle_command();
  681.   
  682.   static    XtCallbackRec    command_call[] = {
  683. --- 304,309 ----
  684. ***************
  685. *** 280,320 ****
  686.   
  687.   static    Arg    command_args[] = {
  688.       {XtNlabel,    NULL},
  689. !     {XtNvertDistance, (XtArgVal) 0},
  690. !     {XtNfromHoriz,    (XtArgVal) NULL},
  691. !     {XtNhorizDistance, (XtArgVal) 7},
  692.       {XtNwidth,    (XtArgVal) 64},
  693.       {XtNheight,    (XtArgVal) 30},
  694. -     {XtNtop,    (XtArgVal) XtChainTop},
  695. -     {XtNbottom,    (XtArgVal) XtChainTop},
  696. -     {XtNleft,    (XtArgVal) XtChainRight},
  697. -     {XtNright,    (XtArgVal) XtChainRight},
  698.       {XtNcallback,    (XtArgVal) command_call},
  699.   };
  700. - static    Arg    line_args[] = {
  701. -     {XtNbackground,    (XtArgVal) 0},
  702. -     {XtNwidth,    (XtArgVal) 1},
  703. -     {XtNheight,    (XtArgVal) 0},
  704. -     {XtNfromHoriz,    (XtArgVal) NULL},
  705. -     {XtNborderWidth, (XtArgVal) 0},
  706. -     {XtNtop,    (XtArgVal) XtChainTop},
  707. -     {XtNbottom,    (XtArgVal) XtChainBottom},
  708. -     {XtNleft,    (XtArgVal) XtChainRight},
  709. -     {XtNright,    (XtArgVal) XtChainRight},
  710. - };
  711. - static    Arg    strut_args[] = {
  712. -     {XtNfromHoriz,    (XtArgVal) NULL},
  713. -     {XtNwidth,    (XtArgVal) 78},
  714. -     {XtNheight,    (XtArgVal) 2},
  715. -     {XtNmappedWhenManaged, (XtArgVal) False},
  716. -     {XtNborderWidth, (XtArgVal) 0},
  717. -     {XtNtop,    (XtArgVal) XtChainTop},
  718. -     {XtNbottom,    (XtArgVal) XtChainTop},
  719. -     {XtNleft,    (XtArgVal) XtChainRight},
  720. -     {XtNright,    (XtArgVal) XtChainRight},
  721. - };
  722.   #endif    BUTTONS
  723.   
  724.   #else    TOOLKIT
  725. --- 313,324 ----
  726.   
  727.   static    Arg    command_args[] = {
  728.       {XtNlabel,    NULL},
  729. !     {XtNx,        (XtArgVal) 6},
  730. !     {XtNy,        (XtArgVal) 0},
  731.       {XtNwidth,    (XtArgVal) 64},
  732.       {XtNheight,    (XtArgVal) 30},
  733.       {XtNcallback,    (XtArgVal) command_call},
  734.   };
  735.   #endif    BUTTONS
  736.   
  737.   #else    TOOLKIT
  738. ***************
  739. *** 359,365 ****
  740.   #ifdef    TOOLKIT
  741.   WidgetClass    viewportWidgetClass, widgetClass;
  742.   #ifdef    BUTTONS
  743. ! WidgetClass    formWidgetClass, commandWidgetClass;
  744.   #endif    BUTTONS
  745.   #endif    TOOLKIT
  746.   #else    X10
  747. --- 363,369 ----
  748.   #ifdef    TOOLKIT
  749.   WidgetClass    viewportWidgetClass, widgetClass;
  750.   #ifdef    BUTTONS
  751. ! WidgetClass    formWidgetClass, compositeWidgetClass, commandWidgetClass;
  752.   #endif    BUTTONS
  753.   #endif    TOOLKIT
  754.   #else    X10
  755. ***************
  756. *** 405,415 ****
  757.       if ((fcx < max_x || tcx < max_x) && (fcx >= min_x || tcx >= min_x) &&
  758.           (fcy < max_y || tcy < max_y) && (fcy >= min_y || tcy >= min_y))
  759.   #ifndef X10
  760. !         XDrawLine(DISP, curr.win, ruleGC,
  761.               fcx - curr.base_x, fcy - curr.base_y,
  762.               tcx - curr.base_x, tcy - curr.base_y);
  763.   #else X10
  764. !         XLine(curr.win,
  765.               fcx - curr.base_x, fcy - curr.base_y,
  766.               tcx - curr.base_x, tcy - curr.base_y,
  767.               1, 1, ruleGC, GXcopy, AllPlanes);
  768. --- 409,419 ----
  769.       if ((fcx < max_x || tcx < max_x) && (fcx >= min_x || tcx >= min_x) &&
  770.           (fcy < max_y || tcy < max_y) && (fcy >= min_y || tcy >= min_y))
  771.   #ifndef X10
  772. !         XDrawLine(DISP, WINDOW(curr), ruleGC,
  773.               fcx - curr.base_x, fcy - curr.base_y,
  774.               tcx - curr.base_x, tcy - curr.base_y);
  775.   #else X10
  776. !         XLine(WINDOW(curr),
  777.               fcx - curr.base_x, fcy - curr.base_y,
  778.               tcx - curr.base_x, tcy - curr.base_y,
  779.               1, 1, ruleGC, GXcopy, AllPlanes);
  780. ***************
  781. *** 427,436 ****
  782.   
  783.       if (cx < max_x && cx >= min_x && cy < max_y && cy >= min_y)
  784.   #ifndef X10
  785. !         XDrawPoint(DISP, curr.win, ruleGC,
  786.           cx - curr.base_x, cy - curr.base_y);
  787.   #else X10
  788. !         XPixSet((Window) curr.win, cx - curr.base_x, cy - curr.base_y,
  789.           1, 1, ruleGC);
  790.   #endif X10
  791.   }
  792. --- 431,440 ----
  793.   
  794.       if (cx < max_x && cx >= min_x && cy < max_y && cy >= min_y)
  795.   #ifndef X10
  796. !         XDrawPoint(DISP, WINDOW(curr), ruleGC,
  797.           cx - curr.base_x, cy - curr.base_y);
  798.   #else X10
  799. !         XPixSet(WINDOW(curr), cx - curr.base_x, cy - curr.base_y,
  800.           1, 1, ruleGC);
  801.   #endif X10
  802.   }
  803. ***************
  804. *** 458,467 ****
  805.       if (x < max_x && x + w >= min_x && y < max_y && y + h >= min_y) {
  806.           if (--event_counter == 0) read_events(False);
  807.   #ifndef X10
  808. !         XFillRectangle(DISP, (Window) curr.win, hl ? highGC : ruleGC,
  809.                      x - curr.base_x, y - curr.base_y, w?w:1, h?h:1);
  810.   #else X10
  811. !         XPixSet((Window) curr.win, x - curr.base_x, y - curr.base_y,
  812.               w?w:1, h?h:1, hl ? highGC : ruleGC);
  813.   #endif X10
  814.       }
  815. --- 462,471 ----
  816.       if (x < max_x && x + w >= min_x && y < max_y && y + h >= min_y) {
  817.           if (--event_counter == 0) read_events(False);
  818.   #ifndef X10
  819. !         XFillRectangle(DISP, WINDOW(curr), hl ? highGC : ruleGC,
  820.                      x - curr.base_x, y - curr.base_y, w?w:1, h?h:1);
  821.   #else X10
  822. !         XPixSet(WINDOW(curr), x - curr.base_x, y - curr.base_y,
  823.               w?w:1, h?h:1, hl ? highGC : ruleGC);
  824.   #endif X10
  825.       }
  826. ***************
  827. *** 482,498 ****
  828.           image->height = bitmap->h;
  829.           image->data = bitmap->bits;
  830.           image->bytes_per_line = bitmap->bytes_wide;
  831. !         XPutImage(DISP, curr.win, foreGC, image,
  832.               0, 0,
  833.               x - curr.base_x, y - curr.base_y,
  834.               bitmap->w, bitmap->h);
  835.           if (foreGC2)
  836. !             XPutImage(DISP, curr.win, foreGC2, image,
  837.               0, 0,
  838.               x - curr.base_x, y - curr.base_y,
  839.               bitmap->w, bitmap->h);
  840.   #else X10
  841. !         XBitmapBitsPut(curr.win, x - curr.base_x, y - curr.base_y,
  842.               bitmap->w, bitmap->h, bitmap->bits,
  843.               foreGC, backpix, NULL, GXfunc, AllPlanes);
  844.   #endif X10
  845. --- 486,502 ----
  846.           image->height = bitmap->h;
  847.           image->data = bitmap->bits;
  848.           image->bytes_per_line = bitmap->bytes_wide;
  849. !         XPutImage(DISP, WINDOW(curr), foreGC, image,
  850.               0, 0,
  851.               x - curr.base_x, y - curr.base_y,
  852.               bitmap->w, bitmap->h);
  853.           if (foreGC2)
  854. !             XPutImage(DISP, WINDOW(curr), foreGC2, image,
  855.               0, 0,
  856.               x - curr.base_x, y - curr.base_y,
  857.               bitmap->w, bitmap->h);
  858.   #else X10
  859. !         XBitmapBitsPut(WINDOW(curr), x - curr.base_x, y - curr.base_y,
  860.               bitmap->w, bitmap->h, bitmap->bits,
  861.               foreGC, backpix, NULL, GXfunc, AllPlanes);
  862.   #endif X10
  863. ***************
  864. *** 499,511 ****
  865.       }
  866.   }
  867.   
  868. ! put_border(x, y, w, h, t)
  869. !     int x, y, w, h, t;
  870.   {
  871. !     put_rectangle(x, y, w, t, True);
  872. !     put_rectangle(x, y, t, h, True);
  873. !     put_rectangle(x, y + h - t, w, t, True);
  874. !     put_rectangle(x + w - t, y, t, h, True);
  875.   }
  876.   
  877.   /*
  878. --- 503,515 ----
  879.       }
  880.   }
  881.   
  882. ! put_border(w, h, t)
  883. !     int w, h, t;
  884.   {
  885. !     put_rectangle(0, 0, w, t, True);    /* top */
  886. !     put_rectangle(w, 0, t, h, True);    /* right */
  887. !     put_rectangle(t, h, w, t, True);    /* bottom */
  888. !     put_rectangle(0, t, t, h, True);    /* left */
  889.   }
  890.   
  891.   /*
  892. ***************
  893. *** 530,536 ****
  894.       struct WindowRec *windowrec;
  895.       int    x, y, w, h;
  896.   {
  897. !     ClearArea((Window) windowrec->win, x, y, w, h);
  898.       expose(windowrec, x, y, w, h);
  899.   }
  900.   
  901. --- 534,540 ----
  902.       struct WindowRec *windowrec;
  903.       int    x, y, w, h;
  904.   {
  905. !     ClearArea(WINDOW(*windowrec), x, y, w, h);
  906.       expose(windowrec, x, y, w, h);
  907.   }
  908.   
  909. ***************
  910. *** 580,586 ****
  911.           windowrec->max_y = windowrec->height;
  912.       }
  913.       else {
  914. !         CopyArea(windowrec->win, x, y, ww, hh, x2, y2);
  915.           if (x > 0) clearexpose(windowrec, ww, 0, x, windowrec->height);
  916.           if (x2 > 0) clearexpose(windowrec, 0, 0, x2, windowrec->height);
  917.           if (y > 0) clearexpose(windowrec, 0, hh, windowrec->width, y);
  918. --- 584,590 ----
  919.           windowrec->max_y = windowrec->height;
  920.       }
  921.       else {
  922. !         CopyArea(WINDOW(*windowrec), x, y, ww, hh, x2, y2);
  923.           if (x > 0) clearexpose(windowrec, ww, 0, x, windowrec->height);
  924.           if (x2 > 0) clearexpose(windowrec, 0, 0, x2, windowrec->height);
  925.           if (y > 0) clearexpose(windowrec, 0, hh, windowrec->width, y);
  926. ***************
  927. *** 730,740 ****
  928.       else {        /* this stuff avoids flicker */
  929.           if (x_bgn < new_x_bgn)
  930.           ClearArea(x_bar, x_bgn, 1, new_x_bgn - x_bgn, BAR_WID);
  931. !         else if (x_bgn > new_x_bgn)
  932.           DarkenArea(x_bar, new_x_bgn, 1, x_bgn - new_x_bgn, BAR_WID);
  933.           if (new_x_end < x_end)
  934.           ClearArea(x_bar, new_x_end, 1, x_end - new_x_end, BAR_WID);
  935. !         else if (new_x_end > x_end)
  936.           DarkenArea(x_bar, x_end, 1, new_x_end - x_end, BAR_WID);
  937.       }
  938.       x_bgn = new_x_bgn;
  939. --- 734,744 ----
  940.       else {        /* this stuff avoids flicker */
  941.           if (x_bgn < new_x_bgn)
  942.           ClearArea(x_bar, x_bgn, 1, new_x_bgn - x_bgn, BAR_WID);
  943. !         else
  944.           DarkenArea(x_bar, new_x_bgn, 1, x_bgn - new_x_bgn, BAR_WID);
  945.           if (new_x_end < x_end)
  946.           ClearArea(x_bar, new_x_end, 1, x_end - new_x_end, BAR_WID);
  947. !         else
  948.           DarkenArea(x_bar, x_end, 1, new_x_end - x_end, BAR_WID);
  949.       }
  950.       x_bgn = new_x_bgn;
  951. ***************
  952. *** 754,764 ****
  953.       else {        /* this stuff avoids flicker */
  954.           if (y_bgn < new_y_bgn)
  955.           ClearArea(y_bar, 1, y_bgn, BAR_WID, new_y_bgn - y_bgn);
  956. !         else if (y_bgn > new_y_bgn)
  957.           DarkenArea(y_bar, 1, new_y_bgn, BAR_WID, y_bgn - new_y_bgn);
  958.           if (new_y_end < y_end)
  959.           ClearArea(y_bar, 1, new_y_end, BAR_WID, y_end - new_y_end);
  960. !         else if (new_y_end > y_end)
  961.           DarkenArea(y_bar, 1, y_end, BAR_WID, new_y_end - y_end);
  962.       }
  963.       y_bgn = new_y_bgn;
  964. --- 758,768 ----
  965.       else {        /* this stuff avoids flicker */
  966.           if (y_bgn < new_y_bgn)
  967.           ClearArea(y_bar, 1, y_bgn, BAR_WID, new_y_bgn - y_bgn);
  968. !         else
  969.           DarkenArea(y_bar, 1, new_y_bgn, BAR_WID, y_bgn - new_y_bgn);
  970.           if (new_y_end < y_end)
  971.           ClearArea(y_bar, 1, new_y_end, BAR_WID, y_end - new_y_end);
  972. !         else
  973.           DarkenArea(y_bar, 1, y_end, BAR_WID, new_y_end - y_end);
  974.       }
  975.       y_bgn = new_y_bgn;
  976. ***************
  977. *** 797,818 ****
  978.       if (mane.win == NULL) {    /* initial creation */
  979.   #ifndef X10
  980.           mane.win = (caddr_t) XCreateSimpleWindow(DISP, top_level,
  981. !             y_thick, x_thick, clip_w, clip_h, 0,
  982.               fore_Pixel, back_Pixel);
  983. !         XSelectInput(DPY (Window) mane.win, ExposureMask |
  984.               ButtonPressMask | ButtonMotionMask | ButtonReleaseMask);
  985.   #else X10
  986.           mane.win = (caddr_t) XCreateWindow(top_level,
  987.               y_thick, x_thick, clip_w, clip_h, 0,
  988.               bdrmap, backmap);
  989. !         XSelectInput((Window) mane.win,  ExposeRegion | ExposeCopy |
  990.               ButtonPressed | ButtonReleased |
  991.               LeftDownMotion | MiddleDownMotion | RightDownMotion);
  992.   #endif X10
  993. !         XMapWindow(DPY (Window) mane.win);
  994.       }
  995.       else
  996. !         XMoveResizeWindow(DPY (Window) mane.win,
  997.           y_thick, x_thick, clip_w, clip_h);
  998.   
  999.           /* process scroll bars */
  1000. --- 801,823 ----
  1001.       if (mane.win == NULL) {    /* initial creation */
  1002.   #ifndef X10
  1003.           mane.win = (caddr_t) XCreateSimpleWindow(DISP, top_level,
  1004. !             y_thick, x_thick,
  1005. !             (unsigned int) clip_w, (unsigned int) clip_h, 0,
  1006.               fore_Pixel, back_Pixel);
  1007. !         XSelectInput(DPY WINDOW(mane), ExposureMask |
  1008.               ButtonPressMask | ButtonMotionMask | ButtonReleaseMask);
  1009.   #else X10
  1010.           mane.win = (caddr_t) XCreateWindow(top_level,
  1011.               y_thick, x_thick, clip_w, clip_h, 0,
  1012.               bdrmap, backmap);
  1013. !         XSelectInput(WINDOW(mane),  ExposeRegion | ExposeCopy |
  1014.               ButtonPressed | ButtonReleased |
  1015.               LeftDownMotion | MiddleDownMotion | RightDownMotion);
  1016.   #endif X10
  1017. !         XMapWindow(DPY WINDOW(mane));
  1018.       }
  1019.       else
  1020. !         XMoveResizeWindow(DPY WINDOW(mane),
  1021.           y_thick, x_thick, clip_w, clip_h);
  1022.   
  1023.           /* process scroll bars */
  1024. ***************
  1025. *** 824,831 ****
  1026.           }
  1027.           else {
  1028.   #ifndef X10
  1029. !         x_bar = XCreateSimpleWindow(DISP, top_level,
  1030. !                 y_thick - 1, -1, clip_w, BAR_THICK - 1, 1,
  1031.                   fore_Pixel, back_Pixel);
  1032.           XSelectInput(DISP, x_bar,
  1033.               ExposureMask | ButtonPressMask | Button2MotionMask);
  1034. --- 829,836 ----
  1035.           }
  1036.           else {
  1037.   #ifndef X10
  1038. !         x_bar = XCreateSimpleWindow(DISP, top_level, y_thick - 1, -1,
  1039. !                 (unsigned int) clip_w, BAR_THICK - 1, 1,
  1040.                   fore_Pixel, back_Pixel);
  1041.           XSelectInput(DISP, x_bar,
  1042.               ExposureMask | ButtonPressMask | Button2MotionMask);
  1043. ***************
  1044. *** 855,862 ****
  1045.           }
  1046.           else {
  1047.   #ifndef X10
  1048. !         y_bar = XCreateSimpleWindow(DISP, top_level,
  1049. !                 -1, x_thick - 1, BAR_THICK - 1, clip_h, 1,
  1050.                   fore_Pixel, back_Pixel);
  1051.           XSelectInput(DISP, y_bar,
  1052.               ExposureMask | ButtonPressMask | Button2MotionMask);
  1053. --- 860,867 ----
  1054.           }
  1055.           else {
  1056.   #ifndef X10
  1057. !         y_bar = XCreateSimpleWindow(DISP, top_level, -1, x_thick - 1,
  1058. !                 BAR_THICK - 1, (unsigned int) clip_h, 1,
  1059.                   fore_Pixel, back_Pixel);
  1060.           XSelectInput(DISP, y_bar,
  1061.               ExposureMask | ButtonPressMask | Button2MotionMask);
  1062. ***************
  1063. *** 989,1002 ****
  1064.               InputOutput, CopyFromParent,
  1065.               CWSaveUnder | CWBorderPixel | CWBackPixel |
  1066.               CWOverrideRedirect, &attr);
  1067. !         XSelectInput(DISP, (Window) alt.win, ExposureMask);
  1068.   #else X10
  1069. !         alt.win = (caddr_t) XCreateWindow((Window) mane.win,
  1070.               x, y, alt.width, alt.height, MAGBORD,
  1071.               bdrmap, backmap);
  1072. !         XSelectInput((Window) alt.win, ExposeRegion);
  1073.   #endif X10
  1074. !         XMapWindow(DPY (Window) alt.win);
  1075.           alt_stat = 1;    /* waiting for exposure */
  1076.       }
  1077.   }
  1078. --- 994,1007 ----
  1079.               InputOutput, CopyFromParent,
  1080.               CWSaveUnder | CWBorderPixel | CWBackPixel |
  1081.               CWOverrideRedirect, &attr);
  1082. !         XSelectInput(DISP, WINDOW(alt), ExposureMask);
  1083.   #else X10
  1084. !         alt.win = (caddr_t) XCreateWindow(WINDOW(mane),
  1085.               x, y, alt.width, alt.height, MAGBORD,
  1086.               bdrmap, backmap);
  1087. !         XSelectInput(WINDOW(alt), ExposeRegion);
  1088.   #endif X10
  1089. !         XMapWindow(DPY WINDOW(alt));
  1090.           alt_stat = 1;    /* waiting for exposure */
  1091.       }
  1092.   }
  1093. ***************
  1094. *** 1027,1033 ****
  1095.       mag_y = y;
  1096.       if (mag_x == new_mag_x && mag_y == new_mag_y) mag_moved = False;
  1097.       compute_mag_pos(&xx, &yy);
  1098. !     XMoveWindow(DPY alt.win, xx, yy);
  1099.       scrollwindow(&alt, (x + mane_base_x) * mane.shrinkfactor - alt.width/2,
  1100.           (y + mane_base_y) * mane.shrinkfactor - alt.height/2);
  1101.   }
  1102. --- 1032,1038 ----
  1103.       mag_y = y;
  1104.       if (mag_x == new_mag_x && mag_y == new_mag_y) mag_moved = False;
  1105.       compute_mag_pos(&xx, &yy);
  1106. !     XMoveWindow(DPY WINDOW(alt), xx, yy);
  1107.       scrollwindow(&alt, (x + mane_base_x) * mane.shrinkfactor - alt.width/2,
  1108.           (y + mane_base_y) * mane.shrinkfactor - alt.height/2);
  1109.   }
  1110. ***************
  1111. *** 1047,1053 ****
  1112.       if (alt.win)
  1113.           if (alt_stat) alt_stat = -1;    /* destroy upon expose */
  1114.           else {
  1115. !         XDestroyWindow(DPY (Window) alt.win);
  1116.           if (curr.win == alt.win) alt_canit = True;
  1117.           alt.win = NULL;
  1118.           mag_moved = False;
  1119. --- 1052,1058 ----
  1120.       if (alt.win)
  1121.           if (alt_stat) alt_stat = -1;    /* destroy upon expose */
  1122.           else {
  1123. !         XDestroyWindow(DPY WINDOW(alt));
  1124.           if (curr.win == alt.win) alt_canit = True;
  1125.           alt.win = NULL;
  1126.           mag_moved = False;
  1127. ***************
  1128. *** 1115,1120 ****
  1129. --- 1120,1128 ----
  1130.       XEvent    *eventp;
  1131.   {
  1132.       int    next_page;
  1133. + #ifndef X10
  1134. +     Window    ww;
  1135. + #endif X10
  1136.   
  1137.       next_page = current_page;
  1138.       switch (ch) {
  1139. ***************
  1140. *** 1198,1210 ****
  1141.           case 'c':    /* unchecked scrollmane() */
  1142.           scrollwindow(&mane, mane.base_x + XKEY(*eventp).x - clip_w/2,
  1143.               mane.base_y + XKEY(*eventp).y - clip_h/2);
  1144. !         paint_x_bar();
  1145. !         paint_y_bar();
  1146.   #ifndef X10
  1147.           XWarpPointer(DISP, None, None, 0, 0, 0, 0,
  1148.               clip_w/2 - XKEY(*eventp).x, clip_h/2 - XKEY(*eventp).y);
  1149.   #else X10
  1150. !         XWarpMouse(mane.win, clip_w/2, clip_h/2, GXcopy);
  1151.   #endif X10
  1152.           return;
  1153.   #endif    TOOLKIT
  1154. --- 1206,1218 ----
  1155.           case 'c':    /* unchecked scrollmane() */
  1156.           scrollwindow(&mane, mane.base_x + XKEY(*eventp).x - clip_w/2,
  1157.               mane.base_y + XKEY(*eventp).y - clip_h/2);
  1158. !         if (x_bar) paint_x_bar();
  1159. !         if (y_bar) paint_y_bar();
  1160.   #ifndef X10
  1161.           XWarpPointer(DISP, None, None, 0, 0, 0, 0,
  1162.               clip_w/2 - XKEY(*eventp).x, clip_h/2 - XKEY(*eventp).y);
  1163.   #else X10
  1164. !         XWarpMouse(WINDOW(mane), clip_w/2, clip_h/2, GXcopy);
  1165.   #endif X10
  1166.           return;
  1167.   #endif    TOOLKIT
  1168. ***************
  1169. *** 1211,1219 ****
  1170.   
  1171.   #ifndef X10
  1172.           case 'M':
  1173. !         XTranslateCoordinates(DISP, eventp->xkey.window, mane.win,
  1174. !             eventp->xkey.x, eventp->xkey.y, &home_x, &home_y,
  1175. !             &number0);    /* throw away last argument */
  1176.           home_x *= mane.shrinkfactor;
  1177.           home_y *= mane.shrinkfactor;
  1178.           return;
  1179. --- 1219,1227 ----
  1180.   
  1181.   #ifndef X10
  1182.           case 'M':
  1183. !         XTranslateCoordinates(DISP, eventp->xkey.window,
  1184. !             WINDOW(mane), eventp->xkey.x, eventp->xkey.y,
  1185. !             &home_x, &home_y, &ww);    /* throw away last argument */
  1186.           home_x *= mane.shrinkfactor;
  1187.           home_y *= mane.shrinkfactor;
  1188.           return;
  1189. ***************
  1190. *** 1230,1247 ****
  1191.   #endif X10
  1192.           case 's':
  1193.           if (!arg0) {
  1194. !             long fac1, fac2;
  1195. !             shrink_factor = 1;
  1196. !             fac1 = ROUNDUP(PAPER_WIDTH, window_w);
  1197. !             fac2 = ROUNDUP(PAPER_HEIGHT, window_h);
  1198. !             if (fac1 < fac2)
  1199. !             number0 = fac2;
  1200. !             else
  1201. !             number0 = fac1;
  1202.           }
  1203.           if (number0 <= 0) goto bad;
  1204.           if (number0 == mane.shrinkfactor) return;
  1205. !         shrink_factor = mane.shrinkfactor = number0;
  1206.           init_page();
  1207.           if (number0 != 1 && number0 != bak_shrink) {
  1208.               bak_shrink = number0;
  1209. --- 1238,1251 ----
  1210.   #endif X10
  1211.           case 's':
  1212.           if (!arg0) {
  1213. !             int temp;
  1214. !             number0 = ROUNDUP(unshrunk_page_w, window_w - 2);
  1215. !             temp = ROUNDUP(unshrunk_page_h, window_h - 2);
  1216. !             if (number0 < temp) number0 = temp;
  1217.           }
  1218.           if (number0 <= 0) goto bad;
  1219.           if (number0 == mane.shrinkfactor) return;
  1220. !         mane.shrinkfactor = number0;
  1221.           init_page();
  1222.           if (number0 != 1 && number0 != bak_shrink) {
  1223.               bak_shrink = number0;
  1224. ***************
  1225. *** 1248,1259 ****
  1226.               reset_fonts();
  1227.           }
  1228.   #ifdef    TOOLKIT
  1229. !         XUnmapWindow(DISP, mane.win);
  1230. !         set_draw_args();
  1231. !         XtSetValues(draw_widget, draw_args, (Cardinal) 2);
  1232.           get_geom();
  1233.           home(False);
  1234. !         XMapWindow(DISP, (Window) mane.win);
  1235.           /* Wait for next event; this will likely be an expose event,
  1236.              so we don't redraw the window twice. */
  1237.           {
  1238. --- 1252,1269 ----
  1239.               reset_fonts();
  1240.           }
  1241.   #ifdef    TOOLKIT
  1242. !         XUnmapWindow(DISP, WINDOW(mane));
  1243. !         {
  1244. !             Dimension replyW, replyH;
  1245. !             if (XtMakeResizeRequest(draw_widget, (Dimension) page_w,
  1246. !                 (Dimension) page_h, &replyW, &replyH)
  1247. !                 == XtGeometryAlmost)
  1248. !             (void) XtMakeResizeRequest(draw_widget, replyW, replyH,
  1249. !                 (Dimension *) NULL, (Dimension *) NULL);
  1250. !         }
  1251.           get_geom();
  1252.           home(False);
  1253. !         XMapWindow(DISP, WINDOW(mane));
  1254.           /* Wait for next event; this will likely be an expose event,
  1255.              so we don't redraw the window twice. */
  1256.           {
  1257. ***************
  1258. *** 1330,1336 ****
  1259.   #ifdef    TOOLKIT
  1260.           XtNextEvent(&event);
  1261.           if (resized) get_geom();
  1262. !         if (event.xany.window == (Window) alt.win &&
  1263.               event.type == Expose) {
  1264.           handle_exp((Widget) NULL, &alt, &event.xexpose);
  1265.           continue;
  1266. --- 1340,1346 ----
  1267.   #ifdef    TOOLKIT
  1268.           XtNextEvent(&event);
  1269.           if (resized) get_geom();
  1270. !         if (event.xany.window == WINDOW(alt) &&
  1271.               event.type == Expose) {
  1272.           handle_exp((Widget) NULL, &alt, &event.xexpose);
  1273.           continue;
  1274. ***************
  1275. *** 1340,1357 ****
  1276.           continue;
  1277.           }
  1278.           string = trbuf;
  1279. !         nbytes = XLookupString(&event, string, TRSIZE, NULL, NULL);
  1280.           if (nbytes > 1) ch = '?';
  1281.           if (nbytes != 0) ch = *string;
  1282.   #else    TOOLKIT
  1283.   
  1284.           XNextEvent(DPY &event);
  1285. !         if (XANY(event).window == (Window) mane.win ||
  1286. !         XANY(event).window == (Window) alt.win) {
  1287.   
  1288.           struct WindowRec *wr = &mane;
  1289.   
  1290. !         if (XANY(event).window == (Window) alt.win) {
  1291.               wr = &alt;
  1292.               /* check in case we already destroyed the window */
  1293.               if (alt_stat < 0) { /* destroy upon exposure */
  1294. --- 1350,1367 ----
  1295.           continue;
  1296.           }
  1297.           string = trbuf;
  1298. !         nbytes = XLookupString(&event.xkey, string, TRSIZE, NULL, NULL);
  1299.           if (nbytes > 1) ch = '?';
  1300.           if (nbytes != 0) ch = *string;
  1301.   #else    TOOLKIT
  1302.   
  1303.           XNextEvent(DPY &event);
  1304. !         if (XANY(event).window == WINDOW(mane) ||
  1305. !         XANY(event).window == WINDOW(alt)) {
  1306.   
  1307.           struct WindowRec *wr = &mane;
  1308.   
  1309. !         if (XANY(event).window == WINDOW(alt)) {
  1310.               wr = &alt;
  1311.               /* check in case we already destroyed the window */
  1312.               if (alt_stat < 0) { /* destroy upon exposure */
  1313. ***************
  1314. *** 1480,1486 ****
  1315.           case KeyPress:
  1316.   #ifndef X10
  1317.               string = trbuf;
  1318. !             nbytes = XLookupString(&event, string, TRSIZE, NULL, NULL);
  1319.   #else X10
  1320.               string = XLookupMapping(&event, &nbytes);
  1321.   #endif X10
  1322. --- 1490,1497 ----
  1323.           case KeyPress:
  1324.   #ifndef X10
  1325.               string = trbuf;
  1326. !             nbytes = XLookupString(&event.xkey, string, TRSIZE, NULL,
  1327. !             NULL);
  1328.   #else X10
  1329.               string = XLookupMapping(&event, &nbytes);
  1330.   #endif X10
  1331. ***************
  1332. *** 1534,1545 ****
  1333.           ClearPage(mane);
  1334.   #ifndef X10
  1335.           get_xy();
  1336. !         XDrawString(DISP, mane.win, foreGC,
  1337.           5 - window_x, 5 + X11HEIGHT - window_y,
  1338.           errtext, strlen(errtext));
  1339.   #else X10
  1340.           if (!font) font = XOpenFont(X10FONT);
  1341. !         XTextMask(mane.win, 5, 5 + X10HEIGHT, errtext, strlen(errtext),
  1342.           font->id, foreGC);
  1343.   #endif X10
  1344.           if (dvi_file) {
  1345. --- 1545,1556 ----
  1346.           ClearPage(mane);
  1347.   #ifndef X10
  1348.           get_xy();
  1349. !         XDrawString(DISP, WINDOW(mane), foreGC,
  1350.           5 - window_x, 5 + X11HEIGHT - window_y,
  1351.           errtext, strlen(errtext));
  1352.   #else X10
  1353.           if (!font) font = XOpenFont(X10FONT);
  1354. !         XTextMask(WINDOW(mane), 5, 5 + X10HEIGHT, errtext, strlen(errtext),
  1355.           font->id, foreGC);
  1356.   #endif X10
  1357.           if (dvi_file) {
  1358. ***************
  1359. *** 1703,1710 ****
  1360.   {"-margins",    ".margins",    XrmoptionSepArg,    (caddr_t) NULL},
  1361.   {"-sidemargin",    ".sideMargin",    XrmoptionSepArg,    (caddr_t) NULL},
  1362.   {"-topmargin",    ".topMargin",    XrmoptionSepArg,    (caddr_t) NULL},
  1363. ! {"-pagewidth",    ".pageWidth",    XrmoptionSepArg,    (caddr_t) NULL},
  1364. ! {"-pageheight",    ".pageHeight",    XrmoptionSepArg,    (caddr_t) NULL},
  1365.   {"-altfont",    ".altFont",    XrmoptionSepArg,    (caddr_t) NULL},
  1366.   {"-l",        ".listFonts",    XrmoptionNoArg,        (caddr_t) "on"},
  1367.   {"+l",        ".listFonts",    XrmoptionNoArg,        (caddr_t) "off"},
  1368. --- 1714,1720 ----
  1369.   {"-margins",    ".margins",    XrmoptionSepArg,    (caddr_t) NULL},
  1370.   {"-sidemargin",    ".sideMargin",    XrmoptionSepArg,    (caddr_t) NULL},
  1371.   {"-topmargin",    ".topMargin",    XrmoptionSepArg,    (caddr_t) NULL},
  1372. ! {"-paper",    ".paper",    XrmoptionSepArg,    (caddr_t) NULL},
  1373.   {"-altfont",    ".altFont",    XrmoptionSepArg,    (caddr_t) NULL},
  1374.   {"-l",        ".listFonts",    XrmoptionNoArg,        (caddr_t) "on"},
  1375.   {"+l",        ".listFonts",    XrmoptionNoArg,        (caddr_t) "off"},
  1376. ***************
  1377. *** 1786,1797 ****
  1378.     (Cardinal) &mg_size[4], XtRInt, (caddr_t) &mg_size[4]},
  1379.   };
  1380.   
  1381. - static    void
  1382. - set_draw_args() {
  1383. -     draw_args[0].value = (XtArgVal) page_w;
  1384. -     draw_args[1].value = (XtArgVal) page_h;
  1385. - }
  1386.   static    Arg    temp_args1[] = {
  1387.       {XtNiconX,    (XtArgVal) 0},
  1388.       {XtNiconY,    (XtArgVal) 0},
  1389. --- 1796,1801 ----
  1390. ***************
  1391. *** 1861,1868 ****
  1392.   {"-margins",    "margins",    SepArg,    StringArg,    (caddr_t) &margins},
  1393.   {"-sidemargin",    "sideMargin",    SepArg,    StringArg,    (caddr_t) &sidemargin},
  1394.   {"-topmargin",    "topMargin",    SepArg,    StringArg,    (caddr_t) &topmargin},
  1395. - {"-altfont",    "altFont",    SepArg,    StringArg,    (caddr_t) &alt_font},
  1396.   {"-paper",    "paper",    SepArg,    StringArg,    (caddr_t) &paper},
  1397.   {"-l",        "listFonts",    TrueArg, BooleanArg,    (caddr_t) &list_fonts},
  1398.   {"+l",        NULL,        FalseArg, BooleanArg,    (caddr_t) &list_fonts},
  1399.   {"-rv",        "reverseVideo",    TrueArg, BooleanArg,    (caddr_t) &reverse},
  1400. --- 1865,1872 ----
  1401.   {"-margins",    "margins",    SepArg,    StringArg,    (caddr_t) &margins},
  1402.   {"-sidemargin",    "sideMargin",    SepArg,    StringArg,    (caddr_t) &sidemargin},
  1403.   {"-topmargin",    "topMargin",    SepArg,    StringArg,    (caddr_t) &topmargin},
  1404.   {"-paper",    "paper",    SepArg,    StringArg,    (caddr_t) &paper},
  1405. + {"-altfont",    "altFont",    SepArg,    StringArg,    (caddr_t) &alt_font},
  1406.   {"-l",        "listFonts",    TrueArg, BooleanArg,    (caddr_t) &list_fonts},
  1407.   {"+l",        NULL,        FalseArg, BooleanArg,    (caddr_t) &list_fonts},
  1408.   {"-rv",        "reverseVideo",    TrueArg, BooleanArg,    (caddr_t) &reverse},
  1409. ***************
  1410. *** 2073,2079 ****
  1411.       char    **p;
  1412.       char    *q;
  1413.   
  1414. !     if (strlen(paper) > 20) return False;
  1415.       i = 0;
  1416.       for (;;) {    /* convert to lower case */
  1417.           c = paper[i];
  1418. --- 2077,2083 ----
  1419.       char    **p;
  1420.       char    *q;
  1421.   
  1422. !     if (strlen(paper) > sizeof(temp) - 1) return False;
  1423.       i = 0;
  1424.       for (;;) {    /* convert to lower case */
  1425.           c = paper[i];
  1426. ***************
  1427. *** 2086,2091 ****
  1428. --- 2090,2096 ----
  1429.       for (p = paper_types; p < paper_types + XtNumber(paper_types); p += 2)
  1430.           if (strcmp(temp, *p) == 0) {
  1431.           (void) strcpy(temp, p[1]);
  1432. +         i = strlen(temp);
  1433.           break;
  1434.           }
  1435.       if (i > 2 && strcmp(temp + i - 2, "cm") == 0) {
  1436. ***************
  1437. *** 2096,2104 ****
  1438.       if (q == NULL) return False;
  1439.       *q = '\0';
  1440.       factor *= pixels_per_inch;
  1441. !     unshrunk_page_w = atof(temp) * factor + 0.5;
  1442. !     unshrunk_page_h = atof(q + 1) * factor + 0.5;
  1443. !     return (unshrunk_page_w != 0 && unshrunk_page_h != 0);
  1444.   }
  1445.   
  1446.   /*
  1447. --- 2101,2109 ----
  1448.       if (q == NULL) return False;
  1449.       *q = '\0';
  1450.       factor *= pixels_per_inch;
  1451. !     unshrunk_paper_w = atof(temp) * factor + 0.5;
  1452. !     unshrunk_paper_h = atof(q + 1) * factor + 0.5;
  1453. !     return (unshrunk_paper_w != 0 && unshrunk_paper_h != 0);
  1454.   }
  1455.   
  1456.   /*
  1457. ***************
  1458. *** 2110,2116 ****
  1459.       char **argv;
  1460.   {
  1461.   
  1462. ! #ifndef    TOOLKIT
  1463.   #ifndef X10
  1464.       XSizeHints    size_hints;
  1465.       XWMHints    wmhints;
  1466. --- 2115,2124 ----
  1467.       char **argv;
  1468.   {
  1469.   
  1470. ! #ifdef    TOOLKIT
  1471. !     Widget    form_widget;
  1472. !     Widget    right_widget;
  1473. ! #else    TOOLKIT
  1474.   #ifndef X10
  1475.       XSizeHints    size_hints;
  1476.       XWMHints    wmhints;
  1477. ***************
  1478. *** 2124,2132 ****
  1479. --- 2132,2148 ----
  1480.   #endif    TOOLKIT
  1481.       int    screen_w, screen_h;
  1482.   
  1483. + #ifndef    VMS
  1484.       prog = rindex(*argv, '/');
  1485. + #else
  1486. +     prog = rindex(*argv, ']');
  1487. + #endif
  1488.       if (prog != NULL) ++prog; else prog = *argv;
  1489.   
  1490. + #ifdef    VMS
  1491. +     if (index(prog, '.') != NULL) *index(prog, '.') = '\0';
  1492. + #endif
  1493.   #ifdef    TOOLKIT
  1494.       top_level = XtInitialize(prog, "XDvi", options, XtNumber(options),
  1495.           &argc, argv);
  1496. ***************
  1497. *** 2243,2249 ****
  1498.           scr++);
  1499.   
  1500.           XGeometry(DISP, scr, icon_geometry, "", 0, 0, 0, 0, 0,
  1501. !               &temp_args1[0].value, &temp_args1[1].value, &junk, &junk);
  1502.           XtSetValues(top_level, temp_args1, XtNumber(temp_args1));
  1503.       }
  1504.           /* Set default window size and icon */
  1505. --- 2259,2266 ----
  1506.           scr++);
  1507.   
  1508.           XGeometry(DISP, scr, icon_geometry, "", 0, 0, 0, 0, 0,
  1509. !             (int *) &temp_args1[0].value,
  1510. !             (int *) &temp_args1[1].value, &junk, &junk);
  1511.           XtSetValues(top_level, temp_args1, XtNumber(temp_args1));
  1512.       }
  1513.           /* Set default window size and icon */
  1514. ***************
  1515. *** 2251,2258 ****
  1516.       screen_w = WidthOfScreen(SCRN) - 2*bwidth;
  1517.       screen_h = HeightOfScreen(SCRN) - 2*bwidth;
  1518.   #ifdef    BUTTONS
  1519. !     temp_args3[0].value = (XtArgVal) (page_w + 100 < screen_w ?
  1520. !                       page_w + 100 : screen_w);
  1521.   #else    BUTTONS
  1522.       temp_args3[0].value = (XtArgVal) (page_w<screen_w ? page_w : screen_w);
  1523.   #endif    BUTTONS
  1524. --- 2268,2275 ----
  1525.       screen_w = WidthOfScreen(SCRN) - 2*bwidth;
  1526.       screen_h = HeightOfScreen(SCRN) - 2*bwidth;
  1527.   #ifdef    BUTTONS
  1528. !     temp_args3[0].value = (XtArgVal) (page_w + XTRA_WID < screen_w ?
  1529. !                       page_w + XTRA_WID : screen_w);
  1530.   #else    BUTTONS
  1531.       temp_args3[0].value = (XtArgVal) (page_w<screen_w ? page_w : screen_w);
  1532.   #endif    BUTTONS
  1533. ***************
  1534. *** 2266,2272 ****
  1535.       form_widget = XtCreateManagedWidget("form", formWidgetClass,
  1536.           top_level, form_args, XtNumber(form_args));
  1537.   
  1538. !     vport_args[0].value = temp_args3[0].value - 79;
  1539.       vport_args[1].value = temp_args3[1].value;
  1540.       vport_widget = XtCreateManagedWidget("vport", viewportWidgetClass,
  1541.           form_widget, vport_args, XtNumber(vport_args));
  1542. --- 2283,2289 ----
  1543.       form_widget = XtCreateManagedWidget("form", formWidgetClass,
  1544.           top_level, form_args, XtNumber(form_args));
  1545.   
  1546. !     vport_args[0].value = temp_args3[0].value - XTRA_WID;
  1547.       vport_args[1].value = temp_args3[1].value;
  1548.       vport_widget = XtCreateManagedWidget("vport", viewportWidgetClass,
  1549.           form_widget, vport_args, XtNumber(vport_args));
  1550. ***************
  1551. *** 2274,2283 ****
  1552.       line_args[0].value = (XtArgVal) high_color ? hl_Pixel : fore_Pixel;
  1553.       line_args[2].value = temp_args3[1].value;
  1554.       line_args[3].value = (XtArgVal) vport_widget;
  1555. !     strut_args[0].value = (XtArgVal) XtCreateManagedWidget("line",
  1556.           widgetClass, form_widget, line_args, XtNumber(line_args));
  1557. !     (void) XtCreateManagedWidget("strut", widgetClass, form_widget,
  1558. !         strut_args, XtNumber(strut_args));
  1559.   
  1560.       command_args[2].value = (XtArgVal) vport_widget;
  1561.       {
  1562. --- 2291,2301 ----
  1563.       line_args[0].value = (XtArgVal) high_color ? hl_Pixel : fore_Pixel;
  1564.       line_args[2].value = temp_args3[1].value;
  1565.       line_args[3].value = (XtArgVal) vport_widget;
  1566. !     right_args[0].value = (XtArgVal) XtCreateManagedWidget("line",
  1567.           widgetClass, form_widget, line_args, XtNumber(line_args));
  1568. !     right_args[2].value = temp_args3[1].value;
  1569. !     right_widget = XtCreateManagedWidget("right", compositeWidgetClass,
  1570. !         form_widget, right_args, XtNumber(right_args));
  1571.   
  1572.       command_args[2].value = (XtArgVal) vport_widget;
  1573.       {
  1574. ***************
  1575. *** 2284,2293 ****
  1576.           int i;
  1577.           for (i = 0; i < XtNumber(command_table); ++i) {
  1578.           command_args[0].value = (XtArgVal) command_table[i].label;
  1579. !         command_args[1].value = (XtArgVal) command_table[i].y_pos;
  1580.           command_call[0].closure = (caddr_t) command_table[i].closure;
  1581. !         command_wid[i] = XtCreateManagedWidget(command_table[i].name,
  1582. !             commandWidgetClass, form_widget,
  1583.               command_args, XtNumber(command_args));
  1584.           }
  1585.       }
  1586. --- 2302,2311 ----
  1587.           int i;
  1588.           for (i = 0; i < XtNumber(command_table); ++i) {
  1589.           command_args[0].value = (XtArgVal) command_table[i].label;
  1590. !         command_args[2].value = (XtArgVal) command_table[i].y_pos;
  1591.           command_call[0].closure = (caddr_t) command_table[i].closure;
  1592. !         (void) XtCreateManagedWidget(command_table[i].name,
  1593. !             commandWidgetClass, right_widget,
  1594.               command_args, XtNumber(command_args));
  1595.           }
  1596.       }
  1597. ***************
  1598. *** 2296,2302 ****
  1599.           top_level, vport_args, XtNumber(vport_args));
  1600.   #endif    BUTTONS
  1601.       clip_widget = XtNameToWidget(vport_widget, "clip");
  1602. !     set_draw_args();
  1603.       draw_widget = XtCreateManagedWidget("drawing", widgetClass,
  1604.           vport_widget, draw_args, XtNumber(draw_args));
  1605.       if (fore_color) XtSetValues(draw_widget, &fore_args, 1);
  1606. --- 2314,2321 ----
  1607.           top_level, vport_args, XtNumber(vport_args));
  1608.   #endif    BUTTONS
  1609.       clip_widget = XtNameToWidget(vport_widget, "clip");
  1610. !     draw_args[0].value = (XtArgVal) page_w;
  1611. !     draw_args[1].value = (XtArgVal) page_h;
  1612.       draw_widget = XtCreateManagedWidget("drawing", widgetClass,
  1613.           vport_widget, draw_args, XtNumber(draw_args));
  1614.       if (fore_color) XtSetValues(draw_widget, &fore_args, 1);
  1615. ***************
  1616. *** 2364,2370 ****
  1617.       XSetStandardProperties(DISP, top_level, dvi_name, prog, NULL,
  1618.           argv, argc, &size_hints);
  1619.   
  1620. !     wmhints.flags = StateHint | IconPixmapHint;
  1621.       wmhints.initial_state = iconic ? IconicState : NormalState;
  1622.       wmhints.icon_pixmap = XCreateBitmapFromData(DISP,
  1623.                   RootWindowOfScreen(SCRN),
  1624. --- 2383,2390 ----
  1625.       XSetStandardProperties(DISP, top_level, dvi_name, prog, NULL,
  1626.           argv, argc, &size_hints);
  1627.   
  1628. !     wmhints.flags = InputHint | StateHint | IconPixmapHint;
  1629. !     wmhints.input = True;    /* window manager must direct input */
  1630.       wmhints.initial_state = iconic ? IconicState : NormalState;
  1631.       wmhints.icon_pixmap = XCreateBitmapFromData(DISP,
  1632.                   RootWindowOfScreen(SCRN),
  1633. diff -cr old/xdvi.h new/xdvi.h
  1634. *** old/xdvi.h    Sun Mar 25 21:21:57 1990
  1635. --- new/xdvi.h    Fri Mar 16 21:32:05 1990
  1636. ***************
  1637. *** 9,16 ****
  1638.   #include <sys/types.h>    /* for sites without X11 */
  1639.   #ifdef    SYSV
  1640.   #include <string.h>
  1641. ! #define index strchr
  1642. ! #define rindex strrchr
  1643.   #include <fcntl.h>
  1644.   #else /* SYSV */
  1645.   #include <strings.h>
  1646. --- 9,16 ----
  1647.   #include <sys/types.h>    /* for sites without X11 */
  1648.   #ifdef    SYSV
  1649.   #include <string.h>
  1650. ! #define    index    strchr
  1651. ! #define    rindex    strrchr
  1652.   #include <fcntl.h>
  1653.   #else /* SYSV */
  1654.   #include <strings.h>
  1655. ***************
  1656. *** 18,26 ****
  1657. --- 18,39 ----
  1658.   #include <sys/file.h>
  1659.   #endif X10
  1660.   
  1661. + #ifdef    VMS
  1662. + #include <string.h>
  1663. + #define    index    strchr
  1664. + #define    rindex    strrchr
  1665. + #define    bzero(a, b)    (void) memset ((void *) (a), 0, (size_t) (b))
  1666. + #endif
  1667.   #include <setjmp.h>
  1668.   
  1669. + #ifndef    OPEN_MODE
  1670. + #ifndef    VMS
  1671.   #define    OPEN_MODE    "r"
  1672. + #else    VMS
  1673. + #define    OPEN_MODE    "r", "ctx=stm"
  1674. + #endif    VMS
  1675. + #endif    OPEN_MODE
  1676.   
  1677.   #define    Printf    (void) printf
  1678.   #define    Fprintf    (void) fprintf
  1679. ***************
  1680. *** 46,56 ****
  1681.   
  1682.   #define    MAXDIM        32767
  1683.   
  1684. ! #define    pixel_conv(x)    ((int) (((x) / shrink_factor) >> 16))
  1685. ! #define    pixel_round(x)    ((int) (((x) / shrink_factor + (1<<15)) >> 16))
  1686.   #define    spellfour(f)    ((long) (sfour(f) * fraction))
  1687.   #define    spellnum(f,n)    ((long) (snum(f,n) * fraction))
  1688. - #define    pxl2spell(x)    (((long) (x)) * shrink_factor << 16)
  1689.   
  1690.   #ifdef X10
  1691.   #undef    MSBITFIRST
  1692. --- 59,75 ----
  1693.   
  1694.   #define    MAXDIM        32767
  1695.   
  1696. ! /*
  1697. !  *    pixel_conv is currently used only for converting absolute positions
  1698. !  *    to pixel values; although normally it should be
  1699. !  *        ((int) ((x) / shrink_factor + (1 << 15) >> 16)),
  1700. !  *    the rounding is achieved instead by moving the constant 1 << 15 to
  1701. !  *    PAGE_OFFSET in dvi_draw.c.
  1702. !  */
  1703. ! #define    pixel_conv(x)    ((int) ((x) / shrink_factor >> 16))
  1704. ! #define    pixel_round(x)    ((int) ROUNDUP(x, shrink_factor << 16))
  1705.   #define    spellfour(f)    ((long) (sfour(f) * fraction))
  1706.   #define    spellnum(f,n)    ((long) (snum(f,n) * fraction))
  1707.   
  1708.   #ifdef X10
  1709.   #undef    MSBITFIRST
  1710. ***************
  1711. *** 58,68 ****
  1712.   #define    BMSHORT
  1713.   #endif X10
  1714.   
  1715. ! #ifdef    SYSV
  1716. ! #define    ANSI_LIB
  1717. ! #else
  1718.   #define    HAS_SIGIO        /* has SIGIO on _sockets_ */
  1719.   #endif
  1720.   
  1721.   #ifdef    BMLONG
  1722.   #define    BMUNIT            unsigned long
  1723. --- 77,87 ----
  1724.   #define    BMSHORT
  1725.   #endif X10
  1726.   
  1727. ! #ifndef    SYSV
  1728. ! #ifndef    VMS
  1729.   #define    HAS_SIGIO        /* has SIGIO on _sockets_ */
  1730.   #endif
  1731. + #endif
  1732.   
  1733.   #ifdef    BMLONG
  1734.   #define    BMUNIT            unsigned long
  1735. ***************
  1736. *** 91,114 ****
  1737.   };
  1738.   
  1739.   extern    struct frame     *stack;
  1740. ! extern    int    stackp;
  1741.   
  1742.   /* entries below with the characters 'dvi' in them are actually stored in
  1743.      scaled pixel units */
  1744.   
  1745. ! #define DVI_H   stack[stackp].dvi_h
  1746. ! #define PXL_H   pixel_conv(stack[stackp].dvi_h)
  1747. ! #define DVI_V   stack[stackp].dvi_v
  1748. ! #define PXL_V   stack[stackp].pxl_v
  1749. ! #define WW      stack[stackp].w
  1750. ! #define XX      stack[stackp].x
  1751. ! #define YY      stack[stackp].y
  1752. ! #define ZZ      stack[stackp].z
  1753.   #define ROUNDUP(x,y) (((x)+(y)-1)/(y))
  1754.   
  1755. - #define    PAPER_WIDTH    ROUNDUP(unshrunk_page_w, shrink_factor)
  1756. - #define    PAPER_HEIGHT    ROUNDUP(unshrunk_page_h, shrink_factor)
  1757.   extern    int    current_page;
  1758.   extern    int    total_pages;
  1759.   extern    double    fraction;
  1760. --- 110,130 ----
  1761.   };
  1762.   
  1763.   extern    struct frame     *stack;
  1764. ! extern    struct frame     *stackp;
  1765.   
  1766.   /* entries below with the characters 'dvi' in them are actually stored in
  1767.      scaled pixel units */
  1768.   
  1769. ! #define DVI_H   stackp->dvi_h
  1770. ! #define PXL_H   pixel_conv(stackp->dvi_h)
  1771. ! #define DVI_V   stackp->dvi_v
  1772. ! #define PXL_V   stackp->pxl_v
  1773. ! #define WW      stackp->w
  1774. ! #define XX      stackp->x
  1775. ! #define YY      stackp->y
  1776. ! #define ZZ      stackp->z
  1777.   #define ROUNDUP(x,y) (((x)+(y)-1)/(y))
  1778.   
  1779.   extern    int    current_page;
  1780.   extern    int    total_pages;
  1781.   extern    double    fraction;
  1782. ***************
  1783. *** 210,215 ****
  1784. --- 226,232 ----
  1785.   extern    Boolean    list_fonts;
  1786.   
  1787.   extern    int    pixels_per_inch;
  1788. + extern    int    unshrunk_paper_w, unshrunk_paper_h;
  1789.   extern    int    unshrunk_page_w, unshrunk_page_h;
  1790.   extern    int    density;
  1791.   
  1792. ***************
  1793. *** 225,230 ****
  1794. --- 242,248 ----
  1795.       int    min_x, max_x, min_y, max_y;    /* for pending expose events */
  1796.   } mane, alt, curr;
  1797.   
  1798. + #define    WINDOW(wr)    ((Window) (wr).win)
  1799.   #define    shrink_factor    curr.shrinkfactor
  1800.   
  1801.   jmp_buf    dvi_env;        /* mechanism to communicate dvi file errors */
  1802.  
  1803. dan
  1804. -----------------------------------------------------------
  1805.             O'Reilly && Associates
  1806.         argv@sun.com / argv@ora.com
  1807.        632 Petaluma Ave, Sebastopol, CA 95472 
  1808.      800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104
  1809.     Opinions expressed reflect those of the author only.
  1810.